//package com.tdcoding.chat.test;
//
//import io.netty.channel.Channel;
//
//import java.io.File;
//import java.util.Date;
//
//import com.tdcoding.chat.action.common.ActionRunnable;
//import com.tdcoding.chat.helper.SecurityHelper;
//import com.tdcoding.chat.helper.StringHelper;
//import com.tdcoding.chat.protocol.AddFriendProtocol.AddFriendReq;
//import com.tdcoding.chat.protocol.BasePacketProtocol.BasePacket;
//import com.tdcoding.chat.protocol.EmailListProtocol.EmailList;
//import com.tdcoding.chat.protocol.EmailListProtocol.EmailList.EmailInfo;
//import com.tdcoding.chat.protocol.InviteToGroupProtocol.InviteToGroupReq;
//import com.tdcoding.chat.protocol.MemberInfoProtocol.MemberInfo;
//import com.tdcoding.chat.protocol.NewsListProtocol.NewsList;
//import com.tdcoding.chat.protocol.NewsListProtocol.NewsList.NewsInfo;
//import com.tdcoding.chat.protocol.RegisterProtocol.RegisterReq;
//
//public class FillDataManager {
//	public static void fillData(final Channel channel,final long userId,final RegisterReq registerReq){
//		new Thread(new Runnable() {
//			
//			@Override
//			public void run() {
//				inviteToGroup(channel,userId,registerReq.getNickName(),registerReq.getUserName());
//				addFriend(channel,userId,registerReq.getUserName(),registerReq.getNickName(), "天天聊管理员请求加您好友。");
//				pushEmail(channel);
//				pushNews(channel);
//			}
//		}).start();
//	}
//	
//	public static void inviteToGroup(Channel channel,long memberId, String nickName,
//			String memberName) {
//		BasePacket.Builder builder = BasePacket.newBuilder();
//		builder.setPlatform(1);
//		builder.setUserId(1000000000000l);
//		builder.setPacketId(StringHelper.packetId());
//		builder.setRequest("inviteToGroup");
//		InviteToGroupReq.Builder inviteToGroupReq = InviteToGroupReq
//				.newBuilder();
//		inviteToGroupReq.setGroupId(2425553393350l);
//		inviteToGroupReq.setGroupName("测试群");
//		MemberInfo.Builder memberInfo1 = MemberInfo.newBuilder();
//		memberInfo1.setIdentity(2);
//		memberInfo1.setMemberId(memberId);
//		memberInfo1.setNickName(nickName);
//		memberInfo1.setMemberName(memberName);
//		inviteToGroupReq.addMemberInfo(memberInfo1);
//		// MemberInfo.Builder memberInfo2 = MemberInfo.newBuilder();
//		// memberInfo2.setIdentity(2);
//		// memberInfo2.setMemberId(1425539832688l);
//		// memberInfo2.setNickName("pansha1");
//		// memberInfo2.setMemberName("pansha2");
//		// inviteToGroupReq.addMemberInfo(memberInfo2);
//		builder.setParameters(inviteToGroupReq.build().toByteString());
//		ActionRunnable runnable = new ActionRunnable(channel,builder.build(),true);
//		runnable.run();
//	}
//
//	public static void addFriend(Channel channel,long friendId, String friendName,
//			String remarkName, String remarkInfo) {
//		BasePacket.Builder builder = BasePacket.newBuilder();
//		builder.setUserId(1000000000000l);
//		builder.setPlatform(1);
//		builder.setRequest("addFriend");
//		builder.setPacketId(StringHelper.packetId());
//		AddFriendReq.Builder addFriend = AddFriendReq.newBuilder();
//		addFriend.setFriendId(friendId);
//		addFriend.setFriendName(friendName);
//		addFriend.setRemarkInfo(remarkName);
//		addFriend.setRemarkName(remarkInfo);
//		addFriend.setRosterName("网友");
//		builder.setParameters(addFriend.build().toByteString());
//		ActionRunnable runnable = new ActionRunnable(channel,builder.build(),true);
//		runnable.run();
//	}
//
//	public static  void pushNews(Channel channel) {
//		NewsList.Builder newsList = NewsList.newBuilder();
//		NewsInfo.Builder builder = NewsInfo.newBuilder();
//		builder.setNewsId(1000000000000l);
//		builder.setNewsLink("http://image.baidu.com/search/detail?ct=503316480&z=0&tn=baiduimagedetail&ipn=d&word=%E5%9B%BE%E7%89%87&step_word=&ie=utf-8&in=&cl=2&lm=-1&st=undefined&cs=806135425,801140138&os=21458280,180756608&pn=3&rn=1&di=110087210420&ln=1000&fr=map0000&fmq=1439965491085_R&ic=undefined&s=undefined&se=&sme=&tab=0&width=&height=&face=undefined&is=0,0&istype=0&ist=&jit=&bdtype=0&gsm=0&objurl=http%3A%2F%2Fpic26.nipic.com%2F20121223%2F9252150_195341264315_2.jpg");
//		builder.setNewsBanner("http://www.tdcoding.com/#");
//		builder.setNewsTitle("天天新闻推送");
//		newsList.addNewsInfo(builder.build());
//		BasePacket.Builder builder2 = BasePacket.newBuilder();
//		builder2.setUserId(1000000000000l);
//		builder2.setPlatform(1);
//		builder2.setRequest("pushNews");
//		ActionRunnable runnable = new ActionRunnable(channel,builder2.build(),true);
//		runnable.run();
//	}
//
//	public static  void pushEmail(Channel channel) {
//		EmailList.Builder eBuilder = EmailList.newBuilder();
//		EmailInfo.Builder builder = EmailInfo.newBuilder();
//		builder.setContent("天天邮件推送测试");
//		builder.setDate(new Date().getTime() + "");
//		builder.setHrefLink("http://www.tdcoding.com/#");
//		builder.setSubject("天天邮件");
//		eBuilder.addEmailInfo(builder.build());
//		BasePacket.Builder builder2 = BasePacket.newBuilder();
//		builder2.setUserId(1000000000000l);
//		builder2.setPlatform(1);
//		builder2.setRequest("pushEmail");
//		ActionRunnable runnable = new ActionRunnable(channel,builder2.build(),true);
//		runnable.run();
//	}
//	
//	public static void main(String[] args) {
//		File file=new File("D:\\ic_person_head.png");
//		String fileName=SecurityHelper.encryptMD5("1000000000000"+file.length() +file.lastModified()+file.getAbsolutePath());
//		System.out.println(fileName);
//	}
//}